package org.sczfdf.constants;

import java.util.logging.Level;

/**
 * @author Created by cgb
 * @date 2023/1/31
 */
public enum Constant {
    /*global===================================================================*/
    /**
     * 项目根路径
     */
    ROOT_DIR("rootDir", System.getProperty("user.dir")),

    /**
     * 配置文件路径
     */
    CONFIG_DIR("configDir", "conf"),

    /**
     * 配置文件名称
     */
    CONF_NAME("confName", "application.properties"),

    /*mail===================================================================*/
    /**
     * 邮件服务器的Host
     * <p>默认网易邮箱
     */
    MAIL_SMTP_HOST("mail.smtpHost", "smtp.163.com"),

    /**
     * 邮件服务器的端口
     * <p>默认25
     */
    MAIL_SMTP_PORT("mail.smtpPort", "25"),

    /**
     * 发件的邮箱账号
     */
    MAIL_SEND_MAIL_ACCOUNT("mail.sendMailAccount", "GitSendMail@163.com"),
    /**
     * 发件邮箱的秘钥
     */
    MAIL_SEND_MAIL_AUTH("mail.sendMailAuth", "NJEKOJIEPXDUPAPX"),

    /**
     * 收件的邮箱账号
     */
    MAIL_RECEIVE_MAIL_ACCOUNT("mail.receiveMailAccount", "chen412235679@163.com"),

    /**
     * 发送邮件触发间隔
     * <p>默认10分钟
     */
    MAIL_SEND_INTERVAL("mail.sendInterval", "10"),


    /*log===================================================================*/
    /**
     * 日志的路径
     * <p>默认error.log
     */
    LOG_FILE("log.logFile", "error.log"),
    /**
     * 日志的级别
     * <p>默认WARNING
     * <p>{@link Level}
     */
    LOG_FILE_LEVEL("log.logFileLevel", "WARNING"),
    /**
     * 懒加载日志文件
     * <p>默认true. false:程序启动创建日志文件
     */
    LOG_FILE_LAZY("log.fileLazy", "true"),

    /*git===================================================================*/
    /**
     * 需要同步的git目录
     * <p>默认项目根目录
     */
    GIT_PATH("git.gitPath", ROOT_DIR.getDefaultValue()),

    /**
     * git提交最小间隔
     * <p>默认10秒
     */
    GIT_PUSH_INTERVAL("git.pushInterval", "10"),

    /**
     * git拉取代码的间隔
     * </p>默认60分钟
     */
    GIT_PULL_INTERVAL("git.pullInterval", "60"),

    /*watch===================================================================*/

    /**
     * 扫描文件间隔
     * </p>默认5秒
     */
    WATCH_INTERVAL("watch.interval", "5"),

    /**
     * 触发时执行其他CMD命令
     * </p>没什么好方法, 用json传输
     * [{"dir":"/user","cmd":"ls"},{"dir":"/Users/cgb/Downloads","cmd":"ls"}]
     */
    WATCH_OTHER_CMD("watch.otherCmd", ""),

    /**
     * 监控的文件后缀. 用,分割
     * <p>默认java和md
     */
    WATCH_WATCH_SUFFIX("watch.watchSuffix", "java,md"),


    ;

    private final String key;
    private final String defaultValue;

    Constant(String key, String defaultValue) {
        this.key = key;
        this.defaultValue = defaultValue;
    }

    public String getKey() {
        return key;
    }

    public String getDefaultValue() {
        return defaultValue;
    }
}
